﻿using System.Data.Entity;
using LuckyLoot.Domain.Entities;
using LuckyLoot.Domain.Entities.People;
using LuckyLoot.Common.Properties;
using LuckyLoot.Domain.Aggregate;
using LuckyLoot.Domain.ValueObjects;

namespace LuckyLoot.Common.Contexts
{
    public class ApplicationContext : DbContext
    {
        public ApplicationContext()
            : base(Resources.ConnectionString)
        {
            Database.SetInitializer<ApplicationContext>(new ApplicationContextInitializer());
            base.Configuration.LazyLoadingEnabled = true;
        }
        
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<TattooArtist>().ToTable("TattooArtists");
            modelBuilder.Entity<TattooApointment>().ToTable("TattooAppointments");

            base.OnModelCreating(modelBuilder);
        }

        public DbSet<User> Users { get; set; }
        public DbSet<Customer> Customers { get; set; }
        public DbSet<Apointment> Apointments { get; set; }
        public DbSet<Picture> Pictures { get; set; }
        public DbSet<Supplier> Suppliers { get; set; }
        public DbSet<Supply> Supplies { get; set; }
        public DbSet<Tool> Tools { get; set; }
    }
}
